<template>
  <div id>
    <h2 class="header">
      <span>9.9</span>包邮
    </h2>
    <div id="banner">
      <router-link to="/home">
        <img src="../assets/baoyou.png" alt />
      </router-link>
    </div>
    <div class="time">
      <van-count-down :time="time">
        <template v-slot="timeData">
          剁手剩余:
          <span class="item">{{ timeData.hours }}</span>时
          <span class="item">{{ timeData.minutes }}</span>分
          <span class="item">{{ timeData.seconds }}</span>秒
        </template>
      </van-count-down>
    </div>

    <div class="cartbox">
    
        <van-card
          class="cart"
          v-for="(item,i) in list"
          :key="i"
          :price="item.pprice"
          :desc="item.pdesc"
          :title="item.pname"
          :thumb="item.pimg"
          @click="btn(item.pid)"
        />
   
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      time: 3000000,
      list: []
    };
  },
  mounted() {
    this.$api.getShopp({ uid: 88991 }).then(res => {
      console.log(res);
      this.list = res.data;
    })
  },
  components: {},
    methods: {
        btn(id){
            this.$router.push('./xiangqing/'+id)
        }
    },
};
</script>

<style scoped lang="scss">
.cart-box {
  overflow: hidden;
}
.cart {
  width: 50%;
  float: left;
  margin-top: 0;
}
.header {
  background: pink;
  width: 100%;
  height: 50px;
  color: white;
  line-height: 50px;
  text-align: center;
  position: fixed;
  left: 0;
  top: 0;
}
.header span {
  font-size: 16px;
}
#banner {
  margin-top: 50px;
}
#banner img {
  width: 100%;
}
.item {
  display: inline-block;
  width: 22px;
  margin-right: 5px;
  color: #fff;
  font-size: 12px;
  text-align: center;
  background-color: #1989fa;
}
.time {
  width: 100%;
  background:greenyellow;
  color: white;
  text-align: center;
}
</style>
